#define DEBUG
#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn=100000;

class Ele {
public:
  int v, k;

  static bool cmp(Ele a, Ele b) {
    return a.v<b.v;
  }
};

class Seg {
public:
  int l, r;
};

class Graph {
public:
  int n, m=1, ind[2*maxn+1], to[8*maxn+1], link[8*maxn+1], id[8*maxn+1], degree[2*maxn+1], cycle[2*maxn+1];

  void addSide(int u, int v, int z) {
    m++;
    to[m] = v;
    id[m] = z;
    link[m] = ind[u];
    ind[u] = m;
    degree[u]++;
  }

  void find(int o) {
    static bool book[8*maxn+1];
    for (int i=ind[o]; i; i=link[i]) {
      if (!book[i]) {
	book[i] = true;
	book[i^1] = true;
	find(to[i]);
	cycle[++cycle[0]] = id[i];
      }
    }
  }
};

int discrete(Seg *s, int n) {
  static Ele eles[2*maxn+1];
  for (int i=1; i<=n; i++) {
    eles[i*2-1].v = s[i].l;
    eles[i*2-1].k = i*2-1;
    eles[i*2].v = s[i].r;
    eles[i*2].k = i*2;
  }

  sort(eles+1, eles+2*n+1, Ele::cmp);

  int now=0;
  eles[0].v = -1;
  for (int i=1; i<=2*n; i++) {
    if (eles[i].v!=eles[i-1].v) {
      now++;
    }
    if (eles[i].k%2) {
      s[eles[i].k/2+1].l = now;
    } else {
      s[eles[i].k/2].r = now;
    }
  }
  return now;
}

void addVirSide(Graph *g) {
  int last=0;
  for (int i=1; i<=g->n; i++) {
    if (g->degree[i]%2) {
      if (last) {
	g->addSide(last, i, 0);
	g->addSide(i, last, 0);
	last = 0;
      } else {
	last = i;
      }
    }
  }
}

int main() {
#ifdef DEBUG
  freopen("3682.in", "r", stdin);
  freopen("3682.out", "w", stdout);
#endif

  static Seg seg[maxn+1];
  int n;
  scanf("%d", &n);
  for (int i=1; i<=n; i++) {
    scanf("%d %d", &seg[i].l, &seg[i].r);
    seg[i].r++;
  }

  static Graph g;

  g.n = discrete(seg, n);

  for (int i=1; i<=n; i++) {
    g.addSide(seg[i].l, seg[i].r, i*2-1);
    g.addSide(seg[i].r, seg[i].l, i*2);
  }

  addVirSide(&g);

  for (int i=1; i<=g.n; i++) {
    g.find(i);
  }

  static int ans[maxn+1];
  for (int i=1; i<=g.cycle[0]; i++) {
    if (g.cycle[i]) {
      ans[g.cycle[i]/2+g.cycle[i]%2] = g.cycle[i]%2;
    }
  }

  for (int i=1; i<=n; i++) {
    printf("%d ", ans[i]);
  }

  fclose(stdin);
  fclose(stdout);
  return 0;
}
